#pragma once

#include <windef.h>
#include "WindowHook.hpp"
#include "Hook.hpp"




/**
 * The WindowHookHelper class helps to connect WindowHook instances with
 * the plain old Win32 hooks procedure, registered with windows.
 *
 * The class registers a static function (windowHook in this case) with windows,
 * through SetWindowsHookEx and forwards those messages to the only static instance
 * of WindowHookHelper.
 */
class WindowHookHelper : public Hook<WindowHook,WH_CALLWNDPROC>
{
public:

	WindowHookHelper();
	~WindowHookHelper();

private:

	/**
	 * This function does some message preprocessing and then dispatches
	 * the messages to all instances of WindowHook.
	 */
	LRESULT windowProc(int nCode, WPARAM wParam, LPARAM lParam) const;



	/**
	 * The static function that is registered with windows.
	 */
	static LRESULT CALLBACK windowHook(int nCode, WPARAM wParam, LPARAM lParam);
};
///////////////////////////////////////////////////////////////////////////////////////////////////
